<template>
  <a-spin :spinning="spinning">
    <div class="main">
      <a-card title="基础信息" :loading="loading">
        <template #extra>
          <a-button type="primary" @click="onSubmit" :disabled="disabled" style="margin-left:10px">保存</a-button>
        </template>
        <div style="display:flex">
          <a-form-model :model="form" style="width:calc(100% - 300px)" labelAlign="right" :rules="rules" ref="ruleForm"
            :labelCol="{ span: 10 }" :wrapperCol="{ span: 14 }">
            <a-row>
              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :xxl="24">
                <div style="display: flex;justify-content: flex-start;vertical-align: middle;align-items: center">
                  <h3 style="color: #969799;">基础档案</h3>
                </div>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.sccode">
                <a-form-model-item label="产品编号">
                  {{ form.sccode }}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品大类" prop="scdl">
                  <a-select v-model="form.scdl" placeholder="请选择产品大类" style="width:100%" @change="changeBig" allow-clear>
                    <a-select-option v-for="(item) in scdlList" :key="item.code" :value="item.code">
                      {{ item.code }}-{{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品小类" prop="scxl">
                  <a-select allow-clear v-model="form.scxl" placeholder="请选择产品小类" style="width:100%"
                    @change="changeSmall">
                    <a-select-option v-for="(item) in scxlList" :key="item.code" :value="item.code">
                      {{ item.code }}-{{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="!showProcess">
                <a-form-model-item label="产品细分">
                  <a-select v-if="scxflList.length" allow-clear v-model="form.scxfl" placeholder="请选择产品细分"
                    style="width:100%">
                    <a-select-option v-for="(item) in scxflList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else allow-clear v-model="form.scxflValue" placeholder="请选择产品细分" @focus="getLittle"
                    style="width:100%">
                    <a-select-option v-for="(item) in scxflList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品名称" prop="scname">
                  <a-input placeholder="请输入产品名称" v-model="form.scname" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="厂家编号">
                  <a-input placeholder="请输入厂家编号" v-model="form.sccshh" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="供应厂商" prop="scsupid">
                  <a-select show-search allow-clear v-model="form.scsupid" placeholder="请选择供应厂商" style="width:100%"
                    @search="getScsupidList" :filterOption="filterOption">
                    <a-select-option v-for="(item) in scsupidList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="放样周期">
                  <a-input placeholder="请输入放样周期" type="number" v-model="form.scvc1" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="大货周期">
                  <a-input placeholder="请输入大货周期" type="number" v-model="form.scdhpricetype" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="对应上货季" prop="scseason">
                  <a-select allow-clear v-if="scseasonList.length" v-model="form.scseason" placeholder="请选择对应上货季"
                    style="width:100%" @focus="getDictChildList('SEASON', 'scseasonList')">
                    <a-select-option v-for="(item) in scseasonList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select allow-clear v-else v-model="form.scseasonValue" placeholder="请选择对应上货季"
                    style="width:100%" @focus="getDictChildList('SEASON', 'scseasonList')">
                    <a-select-option v-for="(item) in scseasonList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="起订数量">
                  <a-input placeholder="起订数量" v-model="form.scmoq" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="关联编号">
                  <a-input placeholder="关联编号" v-model="form.screlation" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="关联类型">
                  <a-select v-if="relationtypeList.length" allow-clear v-model="form.screlationtype" placeholder="请选择关联类型"
                    @focus="getDictChildList('PRODUCT_RELATIONTYPE', 'relationtypeList')" style="width:100%">
                    <a-select-option v-for="(item) in relationtypeList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else allow-clear v-model="form.screlationtypeValue" placeholder="请选择关联类型"
                    @focus="getDictChildList('PRODUCT_RELATIONTYPE', 'relationtypeList')" style="width:100%">
                    <a-select-option v-for="(item) in relationtypeList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="12" :xxl="12">
                <a-form-model-item label="产品备注" :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
                  <a-input placeholder="请输入产品备注" v-model="form.scmemo" type="textarea" />
                </a-form-model-item>
              </a-col>
              <div v-if="showProcess">
                <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :xxl="24">
                  <div style="display: flex;justify-content: flex-start;vertical-align: middle;align-items: center">
                    <h3 style="color: #969799;">加工属性</h3>
                  </div>
                </a-col>
                <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                  <a-form-model-item label="是否再加工" prop="scisprocess">
                    <a-select v-model="form.scisprocess" placeholder="请选择是否再加工" style="width:100%" allow-clear
                      @change="changeIsprocess">
                      <a-select-option value="Y">
                        是
                      </a-select-option>
                      <a-select-option value="N">
                        否
                      </a-select-option>
                    </a-select>
                  </a-form-model-item>
                </a-col>
                <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.scisprocess == 'Y'">
                  <a-form-model-item label="加工类型" prop="scprocesstype">
                    <a-select allow-clear v-if="processtypeList.length" v-model="form.scprocesstype" placeholder="请选择加工类型"
                      style="width:100%">
                      <a-select-option v-for="(item) in processtypeList" :key="item.code" :value="item.code">
                        {{ item.name }}
                      </a-select-option>
                    </a-select>
                    <a-select v-else v-model="form.scprocesstypeValue" placeholder="请选择加工类型" style="width:100%">
                      <a-select-option v-for="(item) in processtypeList" :key="item.code" :value="item.code">
                        {{ item.name }}
                      </a-select-option>
                    </a-select>

                  </a-form-model-item>
                </a-col>

                <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.scisprocess == 'Y'">
                  <a-form-model-item label="底/面编号">
                    <a-input placeholder="请输入底/面编号" v-model="form.sclowercode" @blur="loadLowercode" />
                  </a-form-model-item>
                </a-col>
                <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                  <a-form-model-item label="底布名称" v-if="form.scisprocess == 'Y'">
                    <a-input placeholder="" v-model="form.sclowername" :disabled="true" />
                    <!-- {{form.sclowername}} -->
                  </a-form-model-item>
                </a-col>
                <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.scisprocess == 'N'">
                  <a-form-model-item label="底布小类">
                    <a-select allow-clear v-model="form.sclowersmalltype" placeholder="请选择底布小类" style="width:100%"
                      @change="changeLowersmalltype">
                      <a-select-option v-for="(item) in scxlList" :key="item.code" :value="item.code">
                        {{ item.code }}-{{ item.name }}
                      </a-select-option>
                    </a-select>
                  </a-form-model-item>
                </a-col>
                <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                  <a-form-model-item label="底布细分" v-if="form.scisprocess == 'N'">
                    <a-select allow-clear v-if="lowerminismallList.length" v-model="form.lowerminismalltype"
                      placeholder="请选择底布细分" style="width:100%">
                      <a-select-option v-for="(item) in lowerminismallList" :key="item.code" :value="item.code">
                        {{ item.name }}
                      </a-select-option>
                    </a-select>
                    <a-select v-else v-model="form.lowerminismalltypeValue" placeholder="请选择底布细分" style="width:100%">
                      <a-select-option v-for="(item) in lowerminismallList" :key="item.code" :value="item.code">
                        {{ item.name }}
                      </a-select-option>
                    </a-select>
                  </a-form-model-item>
                </a-col>
                <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                  <a-form-model-item label="其他底布">
                    <a-input placeholder="请输入其他底布" v-model="form.sclowerothers" />
                  </a-form-model-item>
                </a-col>
              </div>
              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :xxl="24">
                <div style="display: flex;justify-content: flex-start;vertical-align: middle;align-items: center">
                  <h3 style="color: #969799;">产品规格</h3>
                </div>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.sccode">
                <a-form-model-item label="产品成分">
                  {{form.sccf}}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="有效门幅" prop="scmf">
                  <a-input placeholder="请输入有效门幅" type="number" v-model="form.scmf" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="平方克重(g/㎡)" prop="scmlkz">
                  <a-input placeholder="请输入平方克重" type="number" v-model="form.scmlkz" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品规格">
                  <a-input placeholder="请输入产品规格" v-model="form.scspec" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :xxl="24">
                <div style="display: flex;justify-content: flex-start;vertical-align: middle;align-items: center">
                  <h3 style="color: #969799;">产品价格</h3>
                </div>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品单价" prop="scprice">
                  <a-input placeholder="请输入产品单价" type="number" v-model="form.scprice" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="标化单价">
                  <!-- <a-input placeholder="" v-model="form.bhprice" :disabled="true" /> -->
                  {{  form.bhprice}}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="核价成本">
                  <a-input placeholder="请输入核价成本" type="number" v-model="form.schj" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="大货单价">
                  <a-input placeholder="请输入大货单价" type="number" v-model="form.scdhprice" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="底布单价">
                  <a-input placeholder="请输入底布单价" type="number" v-model="form.scyhprice" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="小品牌价格">
                  <a-input placeholder="请输入小品牌价格" type="number" v-model="form.scprice1" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="特殊单价">
                  <a-input placeholder="请输入特殊单价" v-model="form.scprice2" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="价格单位">
                  <!-- <a-input placeholder="请输入价格单位" v-model="form.scpricetype" /> -->
                  <a-select allow-clear v-if="scpricetypeList.length" v-model="form.scpricetype"
                      placeholder="请选择价格单位" style="width:100%" @focus="getDictChildList('PRODUCT_PRICEUNIT', 'scpricetypeList')">
                      <a-select-option v-for="(item) in scpricetypeList" :key="item.code" :value="item.code">
                        {{ item.name }}
                      </a-select-option>
                    </a-select>
                    <a-select v-else v-model="form.scpricetypeValue" placeholder="请选择价格单位" style="width:100%" @focus="getDictChildList('PRODUCT_PRICEUNIT', 'scpricetypeList')">
                      <a-select-option v-for="(item) in scpricetypeList" :key="item.code" :value="item.code">
                        {{ item.name }}
                      </a-select-option>
                    </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12" :xxl="12">
                <a-form-model-item label="阶梯价格" :labelCol="{ span: 5 }" :wrapperCol="{ span: 17 }">
                  <a-input placeholder="请输入阶梯价格" v-model="form.scdhpricememo" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :xxl="24">
                <div style="display: flex;justify-content: flex-start;vertical-align: middle;align-items: center">
                  <h3 style="color: #969799;">关键指标</h3>
                </div>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.sccode">
                <a-form-model-item label="合同缩率">
                  {{ form.scmlsl }}
                  <!-- <a-input placeholder="请输入合同缩率" v-model="form.scmlsl" /> -->
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="排料缩率">
                  <a-input placeholder="请输入排料缩率" v-model="form.scmlsl1" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="扭曲率">
                  <a-input placeholder="请输入扭曲率" v-model="form.sctwistrate" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="成衣洗涤" prop="scgy">
                  <a-select allow-clear v-if="scgyList.length" v-model="form.scgy" placeholder="请选择成衣洗涤"
                    style="width:100%" @focus="getDictChildList('PRODUCT_WASH', 'scgyList')">
                    <a-select-option v-for="(item) in scgyList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scgyValue" placeholder="请选择成衣洗涤" style="width:100%"
                    @focus="getDictChildList('PRODUCT_WASH', 'scgyList')">
                    <a-select-option v-for="(item) in scgyList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品外观">
                  <a-select allow-clear v-if="appearanceList.length" v-model="form.scappearance" placeholder="请选择产品外观"
                    style="width:100%" @focus="getDictChildList('PRODUCT_APPEARANCE', 'appearanceList')">
                    <a-select-option v-for="(item) in appearanceList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scappearanceValue" placeholder="请选择产品外观" style="width:100%"
                    @focus="getDictChildList('PRODUCT_APPEARANCE', 'appearanceList')">
                    <a-select-option v-for="(item) in appearanceList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="布面效果">
                  <a-select allow-clear v-if="effectList.length" v-model="form.sceffect" placeholder="请选择布面效果"
                    style="width:100%" @focus="getDictChildList('PRODUCT_EFFECT', 'effectList')">
                    <a-select-option v-for="(item) in effectList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.sceffectValue" placeholder="请选择布面效果" style="width:100%"
                    @focus="getDictChildList('PRODUCT_EFFECT', 'effectList')">
                    <a-select-option v-for="(item) in effectList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="面料特性">
                  <a-select allow-clear v-if="scqualityList.length" v-model="form.scquality" placeholder="请选择面料特性"
                    style="width:100%" @focus="getDictChildList('PRODUCT_CHARACTERISTIC', 'scqualityList')">
                    <a-select-option v-for="(item) in scqualityList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scqualityValue" placeholder="请选择面料特性" style="width:100%"
                    @focus="getDictChildList('PRODUCT_CHARACTERISTIC', 'scqualityList')">
                    <a-select-option v-for="(item) in scqualityList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品工艺">
                  <a-select allow-clear v-if="scfjgyList.length" v-model="form.scfjgy" placeholder="请选择产品工艺"
                    style="width:100%" @focus="getDictChildList('PRODUCT_TECH', 'scfjgyList')">
                    <a-select-option v-for="(item) in scfjgyList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scfjgyValue" placeholder="请选择产品工艺" style="width:100%"
                    @focus="getDictChildList('PRODUCT_TECH', 'scfjgyList')">
                    <a-select-option v-for="(item) in scfjgyList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="排版要求">
                  <a-select allow-clear v-if="scshksList.length" v-model="form.scshks" placeholder="请选择排版要求"
                    style="width:100%" @focus="getDictChildList('PRODUCT_REQUIREMENTS', 'scshksList')">
                    <a-select-option v-for="(item) in scshksList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scshksValue" placeholder="请选择排版要求" style="width:100%"
                    @focus="getDictChildList('PRODUCT_REQUIREMENTS', 'scshksList')">
                    <a-select-option v-for="(item) in scshksList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="产品弹力">
                  <a-select allow-clear v-if="elasticList.length" v-model="form.scelastic" placeholder="请选择产品弹力"
                    style="width:100%" @focus="getDictChildList('PRODUCT_ELASTIC', 'elasticList')">
                    <a-select-option v-for="(item) in elasticList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scelasticValue" placeholder="请选择产品弹力" style="width:100%"
                    @focus="getDictChildList('PRODUCT_ELASTIC', 'elasticList')">
                    <a-select-option v-for="(item) in elasticList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="硬挺度">
                  <a-select allow-clear v-if="stiffnessList.length" v-model="form.scstiffness" placeholder="请选择硬挺度"
                    style="width:100%" @focus="getDictChildList('PRODUCT_STIFFNESS', 'stiffnessList')">
                    <a-select-option v-for="(item) in stiffnessList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scstiffnessValue" placeholder="请选择硬挺度" style="width:100%"
                    @focus="getDictChildList('PRODUCT_STIFFNESS', 'stiffnessList')">
                    <a-select-option v-for="(item) in stiffnessList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>

                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="损耗率">
                  <a-input placeholder="请输入损耗率" type="number" v-model="form.scn1" />
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" :xxl="24">
                <div style="display: flex;justify-content: flex-start;vertical-align: middle;align-items: center">
                  <h3 style="color: #969799;">推广属性</h3>
                </div>
              </a-col>

              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.sccode">
                <a-form-model-item label="环保标签">
                  <!-- <a-input placeholder="请输入环保标签" v-model="form.scoriginarea" /> -->
                  {{ form.scoriginarea }}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="进口产地">
                  <a-select allow-clear v-if="scimportareaList.length" v-model="form.scimportarea" placeholder="请选择进口产地"
                    style="width:100%" @focus="getDictChildList('PRODUCT_IMPORT', 'scimportareaList')">
                    <a-select-option v-for="(item) in scimportareaList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scimportareaValue" placeholder="请选择进口产地" style="width:100%"
                    @focus="getDictChildList('PRODUCT_IMPORT', 'scimportareaList')">
                    <a-select-option v-for="(item) in scimportareaList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="原料产地">
                  <a-select allow-clear v-if="environmentalList.length" v-model="form.scenvironmental"
                    placeholder="请选择原料产地" style="width:100%"
                    @focus="getDictChildList('PRODUCT_ORIGIN', 'environmentalList')">
                    <a-select-option v-for="(item) in environmentalList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scenvironmentalValue" placeholder="请选择原料产地" style="width:100%"
                    @focus="getDictChildList('PRODUCT_ORIGIN', 'environmentalList')">
                    <a-select-option v-for="(item) in environmentalList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="服用功能">
                  <a-select allow-clear v-if="scfzytList.length" v-model="form.scfzyt" placeholder="请选择服用功能"
                    style="width:100%" @focus="getDictChildList('PRODUCT_FUNCTION', 'scfzytList')">
                    <a-select-option v-for="(item) in scfzytList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scfzytValue" placeholder="请选择服用功能" style="width:100%"
                    @focus="getDictChildList('PRODUCT_FUNCTION', 'scfzytList')">
                    <a-select-option v-for="(item) in scfzytList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="高档材料">
                  <a-select allow-clear v-if="seniormaterialList.length" v-model="form.scseniormaterial"
                    placeholder="请选择高档材料" style="width:100%" @change="changeSeniormaterial"
                    @focus="getDictChildList('PRODUCT_SENIORMATERIAL', 'seniormaterialList')">
                    <a-select-option v-for="(item) in seniormaterialList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scseniormaterialValue" placeholder="请选择高档材料" style="width:100%"
                    @focus="getDictChildList('PRODUCT_SENIORMATERIAL', 'seniormaterialList')">
                    <a-select-option v-for="(item) in seniormaterialList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="材料等级">
                  <a-select allow-clear v-if="materiallevelList.length" v-model="form.scmateriallevel"
                    placeholder="请选择材料等级" style="width:100%">
                    <a-select-option v-for="(item) in materiallevelList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                  <a-select v-else v-model="form.scmateriallevelValue" placeholder="请选择材料等级" style="width:100%">
                    <a-select-option v-for="(item) in materiallevelList" :key="item.code" :value="item.code">
                      {{ item.name }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="24" :xxl="24">
                <div style="display: flex;justify-content: flex-start;vertical-align: middle;align-items: center">
                  <h3 style="color: #969799;">其他属性</h3>
                </div>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="图案编号">
                  <a-select allow-clear v-model="form.scpiccode" placeholder="请选择图案编号" style="width:100%" show-search
                    @change="changePattern">
                    <a-select-option v-for="(item, index) in patternList" :key="index" :value="item.patternCode">
                      {{ item.patternCode }}
                    </a-select-option>
                  </a-select>
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="图案名称">
                  <!-- <a-input placeholder="请输入图案名称" v-model="form.scpicName" :disabled="true" /> -->
                  {{ form.scpicName }}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="商检成分">
                  <!-- <a-input placeholder="请输入商检成分" v-model="form.composition" :disabled="true"/> -->
                  {{ form.composition }}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.sccode">
                <a-form-model-item label="制单人">
                  <!-- <a-input placeholder="请输入制单人" v-model="form.sccreator" :disabled="true" /> -->
                  {{ form.sccreator }}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6" v-if="form.sccode">
                <a-form-model-item label="制单日期">
                  <!-- <a-input placeholder="请输入制单日期" v-model="form.updatedate" :disabled="true" /> -->
                  {{ form.updatedate }}
                </a-form-model-item>
              </a-col>
              <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="8" :xxl="6">
                <a-form-model-item label="档存编号">
                  <a-input placeholder="请输入档存编号" v-model="form.scdesignbill" />
                </a-form-model-item>
              </a-col>

            </a-row>


          </a-form-model>
          <div style="width:300px;padding: 35px 20px;">
            <JImageUpload style="display:flex;flex-wrap: wrap;width:100%"
              :uploadParams="getUploadParams()" :isMultiple="true" :number="1" @fileChange="fileChange"
              v-model="schavpict"></JImageUpload>
            <a-textarea allow-clear v-model="form.scriskassessment" style="width:290px" :rows="8"
              placeholder="产品风险评估，手工输入文本">
            </a-textarea>
            <a-textarea allow-clear v-model="form.scpopularize" style="width:290px;margin-top:10px" :rows="8"
              placeholder="产品推广资料，手工输入文本">
            </a-textarea>
            <div style="display:flex;width: 300px;margin-top:10px">是否推荐
              <a-radio-group style="margin-left:10px" name="radioGroup" v-model="form.scisrecommend">
                <a-radio :value="'Y'">
                  是
                </a-radio>
                <a-radio :value="'N'">
                  否
                </a-radio>
              </a-radio-group>
            </div>
            <div v-if="form.sccode" style="display:flex;width: 300px;margin-top:20px;">
              <div style="width: 100px;line-height: 32px;font-size:16px;font-weight: 500;">服用功能报告</div>
              <fileUpload style="display:flex;flex-wrap: wrap;width:100px;marfin-left:10px"
                :uploadParams="getUploadParams()" :isMultiple="true" :number="5" @fileChange1="fileChange1"
                v-model="filePath1"></fileUpload>
              <a-button @click="saveFile(1)">保存</a-button>
            </div>
            <div v-if="form.sccode" style="display:flex;width: 300px;margin-top:20px;">
              <div style="width: 100px;line-height: 32px;font-size:16px;font-weight: 500;">进口产地报告</div>
              <fileUpload1 style="display:flex;flex-wrap: wrap;width:100px;marfin-left:10px"
                :uploadParams="getUploadParams()" :isMultiple="true" :number="5" @fileChange2="fileChange2"
                v-model="filePath2"></fileUpload1>
              <a-button @click="saveFile(2)">保存</a-button>
            </div>
            <div v-if="form.sccode" style="display:flex;width: 300px;margin-top:20px;">
              <div style="width: 100px;line-height: 32px;font-size:16px;font-weight: 500;">原料产地报告</div>
              <fileUpload1 style="display:flex;flex-wrap: wrap;width:100px;marfin-left:10px"
                :uploadParams="getUploadParams()" :isMultiple="true" :number="5" @fileChange2="fileChange3"
                v-model="filePath3"></fileUpload1>
              <a-button @click="saveFile(3)">保存</a-button>
            </div>
          </div>

        </div>
      </a-card>
      <a-card v-if="form.sccode">
        <a-tabs :default-active-key="0" v-model="current" @change="changeTab">
          <a-tab-pane :key="0" tab="颜色">
          </a-tab-pane>
          <a-tab-pane :key="1" tab="产品缩率">
          </a-tab-pane>
          <a-tab-pane :key="2" tab="物料成分">
          </a-tab-pane>
        </a-tabs>
        <color v-show="current == 0" :colorList="colorList" :sccode="sccode" :patternCode="patternCode"
          @changeColor="changeColor"></color>
        <minifi v-show="current == 1" :minifiList="minifiList" :sccode="sccode" @changeminifi="changeminifi"></minifi>
        <group v-show="current == 2" :groupList="groupList" :sccode="sccode" @changegroup="changegroup"></group>
        <div style="display: flex;justify-content: flex-end;">
          <a-pagination v-model="pageNum" :total="total" :item-render="itemRender" :show-total="total => `共 ${total} 条记录`"
            :page-size="pageSize" show-quick-jumper @change="onChange" />
        </div>
      </a-card>
    </div>
  </a-spin>
</template>

<script>
import color from './color.vue'
import minifi from './minifi.vue'
import group from './group.vue'
import JImageUpload from './upload/JImageUpload.vue'
import fileUpload from './upload/uploadfile.vue'
import fileUpload1 from './upload/uploadfile1.vue'
import fileUpload2 from './upload/uploadfile2.vue'
import globalData from '@/assets/js/common'
import { postAction } from '@/api/manage'
import { axios } from '@/utils/request'
import { seachSupply, getSampleInfo, getSampleColorList, getSampleMinifiList, getSampleGroupList, seachPattern, sampleUpdate, sampleAdd, getuploadFiles, getDictChildList } from '@api/material/index'
export default {
  components: {
    color,
    minifi,
    group,
    JImageUpload,
    fileUpload,
    fileUpload1,
    fileUpload2
  },
  data() {
    return {
      sccode: '',
      patternCode: '',
      scpricetypeList:[],
      scdlList: [],
      scxlList: [],
      scxflList: [],
      scsupidList: [],
      scseasonList: [],
      scqualityList: [],
      scimportareaList: [],
      scgyList: [],
      appearanceList: [],
      effectList: [],
      elasticList: [],
      stiffnessList: [],
      environmentalList: [],
      seniormaterialList: [],
      materiallevelList: [],
      scfjgyList: [],
      scshksList: [],
      scfzytList: [],
      relationtypeList: [],
      processtypeList: [],
      lowercodeList: [],
      lowersmalltypeList: [],
      patternList: [],
      lowerminismallList: [],
      classifyMinimumList: [],
      spinning: false,
      taxRate: '',
      current: 0,
      urlKey: 'basemgt-material/',
      form: {
        flag3d: "",
        platformid: "",
        jobnumber: '',
        sampleClothGroupDTOList: [],
        sampleClothMatColorDTOList: [],
        sampleClothMinificationDTOList: [],
        scc130: "",
        scxfl: undefined,
        screlation: '',
        scmoq:'',
        screlationtype: undefined,
        scisprocess: undefined,
        scprocesstype: undefined,
        sclowercode: undefined,
        scappearance: undefined,
        sceffect: undefined,
        scelastic: undefined,
        scstiffness: undefined,
        scenvironmental: undefined,
        scseniormaterial: undefined,
        scmateriallevel: undefined,
        sclowersmalltype: undefined,
        scoriginarea: '',
        sctwistrate: '',
        sclowername: '',
        sclowerothers: '',
        scdhpricetype: '',
        scyhprice: '',
        sccf: "",
        sccjsh: "",
        sccode: "",
        sccreatdate: "",
        sccshh: "",
        sccw: "",
        scdesignbill: "",
        scdhprice: "",
        scdhpricememo: "",
        scdl: undefined,
        scfjgy: undefined,
        scfsfs: "",
        scfzyt: undefined,
        scgy: undefined,
        scgymain: "",
        schavpict: "",
        schj: '',
        scimportarea: undefined,
        scisrk: "",
        scisrecommend:'Y',
        sckcsl: 0,
        bhprice:'',
        scmatertype1: "",
        scmatertype2: "",
        scmemo: "",
        scmf: "",
        scmlkz: "",
        scmlsl: "",
        scmlsl1: "",
        scn1: '',
        scname: "",
        lowerminismalltype: undefined,
        scpiccode: undefined,
        scpicName: '',
        scprice: '',
        scprice1: '',
        scpricetype: "",
        scquality: undefined,
        scseason: undefined,
        scshks: undefined,
        scsupid: undefined,
        scprice2: "",
        scvc1: "",
        scxl: undefined,
        scpopularize: '',
        scriskassessment: '',
      },
      rules: {
        scdl: [{ required: true, message: '请选择产品大类', trigger: 'change' }],
        scxl: [{ required: true, message: '请选择产品小类', trigger: 'change' }],
        scname: [{ required: true, message: '请输入产品名称', trigger: 'change' }],
        scsupid: [{ required: true, message: '请选择供应厂商', trigger: 'change' }],
        scisprocess: [{ required: true, message: '请选择是否再加工', trigger: 'change' }],
        scprocesstype: [{ required: true, message: '请选择加工类型', trigger: 'change' }],
        // sccf: [{ required: true, message: '请输入产品成分', trigger: 'change' }],
        scprice: [{ required: true, message: '请输入产品单价', trigger: 'change' }],
        scseason: [{ required: true, message: '请输入对应上货季', trigger: 'change' }],
        scmf: [{ required: true, message: '请输入有效门幅', trigger: 'change' }],
        scmlkz: [{ required: true, message: '请输入平方克重', trigger: 'change' }],
        scgy: [{ required: true, message: '请选择成衣洗涤', trigger: 'change' }],
      },
      showProcess: false,
      colorList: [],
      minifiList: [],
      groupList: [],
      filePath1: [],
      fileList1: [],
      filePath2: [],
      filePath3: [],
      schavpict: [],
      typeList:[],
      total: 0,
      pageNum: 1,
      pageSize: 10,
      itemRender: (current, type, originalElement) => {
        if (type === 'prev') {
          return <a>上一页</a>
        } else if (type === 'next') {
          return <a>下一页</a>
        }
        return originalElement
      },
      priceList: [],
      supplyList: [],
      showSupply: false,
      showPrice: false,
      showCopy: false,
      loading: false,
      supplyDetail: {},
      supplyIndex: null,
      showPrint: false,
      showSelect: false,
      printType: '',
      priceProgramme: '',
      list: [],
      supplyCode: '',
      newLifePhotos: [],
      disabled: false,
      current: 0,
      ifChange: false
    }
  },
  watch: {
    // sccode(newVal, oldVal) {
    //   if (newVal && newVal !== oldVal) {
    //     this.loadAcc(newVal)
    //   }
    // },
  },
  created() { },
  computed: {
    jobNumber() {
      return this.$store.getters.userInfo.workNo || ''
    },
    userInfo() {
      return this.$store.getters.userInfo || null
    }
  },
  mounted() {
    this.loadData()
    if (this.$route.query.sccode) {
      this.sccode = this.$route.query.sccode
      this.$nextTick(() => {
        this.loadAcc(this.sccode)
        this.loadColor()
        this.getTypeList()

        // this.getFileList()
        // this.loadminifi()
        // this.loadgroup()
        // this.loadAccSpecs()
      })
    }
  },
  methods: {
    filterOption(input, option) {
      if (option && option.props && option.props.title) {
        return option.props.title === input || option.props.title.indexOf(input) !== -1
      } else {
        return true
      }
    },
    changeTab() {
      this.pageNum = 1
      if (this.current == 0) {
        this.loadColor()
      } else if (this.current == 1) {
        this.loadminifi()
      } else {
        this.loadgroup()
      }
    },
    onChange() {
      if (this.current == 0) {
        this.loadColor()
      } else if (this.current == 1) {
        this.loadminifi()
      } else {
        this.loadgroup()
      }
    },
    async getScsupidList(value) {
      const res = await seachSupply({ keyWord: value })
      if (res.code == 200) {
        this.scsupidList = res.data
      } else {
        if (res.msg) {
          this.$message.error(res.msg)
        } else {
          this.$message.error('获取供应商列表失败！')
        }
      }
    },
    async getPatternList(value) {
      const res = await seachPattern({ keyWord: value })
      if (res.code == 200) {
        this.patternList = res.data
        this.changePattern()
      } else {
        if (res.msg) {
          this.$message.error(res.msg)
        } else {
          this.$message.error('获取图案列表失败！')
        }
      }
    },
    async loadLowercode() {
      const res = await getSampleInfo({ sccode: this.form.sclowercode })
      if (res.code == 200) {
        this.form.sclowername = res.data.scname
        this.form.sclowersmalltype = res.data.scxl
        this.changeLowersmalltype()
      } else {
        if (res.msg) {
          this.$message.error(res.msg)
        } else {
          this.$message.error('查找底布失败！')
        }
      }
    },
    changeIsprocess() {
      this.form.scprocesstype = undefined
      this.form.sclowercode = ''
      this.form.sclowername = ''
      this.form.sclowersmalltype = undefined
    },
    loadData() {
      this.getDictChildList('PRODUCT_BIGTYPE', 'scdlList')
      this.getScsupidList()
      this.getPatternList()
    },
    async getDictChildList(name, list, id) {
      if (!this[list].length || (this[list].length && id)) {
        const params = {
          name: name,
          parentId: id
        }
        try {
          const res = await getDictChildList(params)
          if (res.code == 200) {
            this[list] = res.data
          } else {
            if (res.msg) {
              this.$message.error(res.msg)
            } else {
              this.$message.error('获取数据字典失败！')
            }
          }
        } catch (error) {
          this.$message.error('获取数据字典失败！')
        }
      }
      if (this.processtypeList.length) {
        this.showProcess = true
      } else {
        this.showProcess = false
      }
      if(name == 'PRODUCT_BIGTYPE'){
        this.scdlList.map(item => {
          if (item.code == this.form.scdl && item.extendAttr1) {
            this.form.scn1 = item.extendAttr1
          }
        })
      }
      if (name == 'PRODUCT_BIGTYPE' && this.form.sccode) {
        this.scdlList.map(item => {
          if (item.code == this.form.scdl) {
            this.getDictChildList('PRODUCT_SMALLTYPE', 'scxlList', item.id)
          }
        })
      }
      if (name == 'PRODUCT_SMALLTYPE' && this.form.sccode) {
        this.scxlList.map(item => {
          if (item.code == this.form.scxl) {
            this.getDictChildList('PRODUCT_MINISMALLTYP', 'scxflList', item.id)
            this.getDictChildList('PRODUCT_TECHNOLOGY', 'processtypeList', item.id)
          }
        })
      }
    },
    changeBig() {
      this.form.scxl = undefined
      if (this.scdlList) {
        this.scdlList.map(item => {
          if (item.code == this.form.scdl) {
            this.form.scn1 = item.extendAttr1
            this.getDictChildList('PRODUCT_SMALLTYPE', 'scxlList', item.id)
          }
        })
      }
    },
    changeSmall() {
      this.form.scxfl = undefined
      this.form.scprocesstype = undefined
      this.processtypeList = []
      if (this.scxlList) {
        this.scxlList.map(item => {
          if (item.code == this.form.scxl) {
            this.getDictChildList('PRODUCT_MINISMALLTYP', 'scxflList', item.id)
            this.getDictChildList('PRODUCT_TECHNOLOGY', 'processtypeList', item.id)
          }
        })
      }
    },
    changeLowersmalltype() {
      this.form.lowerminismalltype = undefined
      if (this.scxlList) {
        this.scxlList.map(item => {
          if (item.code == this.form.sclowersmalltype) {
            this.getDictChildList('PRODUCT_MINISMALLTYP', 'lowerminismallList', item.id)
          }
        })
      }
    },
    changeSeniormaterial() {
      this.form.scmateriallevel = undefined
      if (this.seniormaterialList) {
        this.seniormaterialList.map(item => {
          if (item.code == this.form.scseniormaterial) {
            this.getDictChildList('PRODUCT_MATERIALLEVEL', 'materiallevelList', item.id)
          }
        })
      }
    },
    changePattern() {
      this.patternCode = this.form.scpiccode
      this.form.scpicName = ''
      if (this.patternList && this.form.scpiccode) {
        this.patternList.map(item => {
          if (item.patternCode == this.form.scpiccode) {
            this.form.scpicName = item.patternName
          }
        })
      }
    },
    getLittle() {

    },
    getSmall() {
      if (this.form.classifyBig) {
        this.classifyBigList.map(item => {
          if (item.code == this.form.classifyBig) {
            this.getDictChildList('PRODUCT_SMALLTYPE', 'scxlList', item.id)
          }
        })
      }
    },
    getMin() {
      this.getDictChildList('CLASSIFY_MINIMUM', 'classifyMinimumList')
    },
    getModel(name, list) {
      if (this.form.scxl) {
        this.scxlList.map(item => {
          if (item.code == this.form.scxl) {
            this.getDictChildList(name, list, item.id)
          }
        })
      }
    },
    handleCancel() {
      this.showSelect = false
    },
    handleOk() {
      if (this.printType) {
        this.showSelect = false
        this.showPrint = true
      } else {
        this.$message.warning('请先选择打印类型！')
      }
    },
    getUploadParams() {
      return { ...globalData.uploadParams }
    },
    fileChange(list) {
      if (list.length) {
        this.form.schavpict = list[0].url
      } else {
        this.form.schavpict = ''
      }
      this.newLifePhotos = list

    },
    fileChange1(list) {
      this.fileList1 = list
      console.log(this.fileList1);
    },
    fileChange2(list) {
      this.fileList2 = list
    },
    fileChange3(list) {
      this.fileList3 = list
    },
    async saveFile(type) {
      const formData = new FormData()
      if (type == 1) {
        this.fileList1.forEach((file) => {
          formData.append(`files`, file.originFileObj);
        });
      } else if (type == 2) {
        this.fileList2.forEach((file) => {
          formData.append(`files`, file.originFileObj);
        });
      } else {
        this.fileList3.forEach((file) => {
          formData.append(`files`, file.originFileObj);
        });
      }
      formData.append('sccode', this.sccode)
      formData.append('type', type)
      const apiBaseUrl = window._CONFIG['domianURL'] || "/jeecg-boot";
      axios({
        url: apiBaseUrl + '/api/gateway/basemgt-material/sample-upload-file/uploadFiles',
        method: 'post',
        data: formData,
        contentType: false,
        cache: false,
        processData: false,//用于对data参数进行序列化处理 这里必须false
        // headers: { 'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundarynl6gT1BKdPWIejNq' }
      }).then(res => {
        if (res.code == 200) {
          this.$message.success('保存成功')
        } else {
          this.$message.warning(res.msg || '操作失败')
        }
        this.loading = false
      })

    },
    changeColor() {
      this.loadColor()
    },
    changeminifi() {
      this.loadminifi()
    },
    changegroup() {
      this.loadgroup()
    },

    changeSupply(supplyList) {
      this.form.accSupplyList = supplyList
      if (this.form.priceProgramme == 'ZIPPER') {
        this.ifChange = true
      }
    },
    async getFileList() {
        const params = {
          sccode: this.sccode,
          type: '',
          current: 1,
          size: 100
        }
        try {
          const res = await getuploadFiles(params)
          if (res.code == 200) {
            if(res.data.records.length){
              res.data.records.map((item)=>{
              if(item.type == 1){
                this.filePath1.push(item.fileUrl)
              }else if(item.type == 2){
                this.filePath2.push(item.fileUrl)
              }else if(item.type == 3){
                this.filePath3.push(item.fileUrl)
              }
            })
            }
          } else {
            if (res.msg) {
              this.$message.error(res.msg)
            } else {
              this.$message.error('获取列表失败！')
            }
          }
        } catch (error) {
          this.$message.error('获取列表失败！')
        }
    },
    async loadColor() {
      const params = {
        sccode: this.sccode,
        size: this.pageSize,
        pageNo: this.pageNum
      }
      try {
        const res = await getSampleColorList(params)
        if (res.code == 200) {
          this.colorList = res.data.records
          this.total = res.data.total
        } else {
          if (res.msg) {
            this.$message.error(res.msg)
          } else {
            this.$message.error('获取颜色列表失败！')
          }
        }
      } catch (error) {
        this.$message.error('获取颜色列表失败！')
      }
    },
    async loadminifi() {
      const params = {
        sccode: this.sccode,
        size: this.pageSize,
        pageNo: this.pageNum
      }
      try {
        const res = await getSampleMinifiList(params)
        if (res.code == 200) {
          this.minifiList = res.data.records
          this.total = res.data.total
        } else {
          if (res.msg) {
            this.$message.error(res.msg)
          } else {
            this.$message.error('获取缩率列表失败！')
          }
        }
      } catch (error) {
        this.$message.error('获取缩率列表失败！')
      }
    },
    async loadgroup() {
      // this.form.sccf = ''
      const params = {
        sccode: this.sccode,
        size: this.pageSize,
        pageNo: this.pageNum
      }
      try {
        const res = await getSampleGroupList(params)
        if (res.code == 200) {
          this.groupList = res.data.records
          // if(this.groupList.length){
          //   this.form.sccf = this.groupList[0].sccfValue
          // }   
          this.total = res.data.total
          const newArr = []
          res.data.records.map((item)=>{
            this.typeList.map((subitem)=>{
              if(item.sccf == subitem.code){
                newArr.push(subitem.extendAttr1)
              }
            })
          })
          if(newArr.includes('Y')){
            this.form.scoriginarea = 'Y'
          }else{
            this.form.scoriginarea = ''
          }
        } else {
          if (res.msg) {
            this.$message.error(res.msg)
          } else {
            this.$message.error('获取成分列表失败！')
          }
        }
      } catch (error) {
        this.$message.error('获取成分列表失败！')
      }
    },
    async getTypeList() {
      const params = {
        name: 'PRODUCT_COMPONENT',
      }
      try {
        const res = await getDictChildList(params)
        if (res.code == 200) {
          this.typeList = res.data
          this.loadScoriginarea()
        } else {
          if (res.msg) {
            this.$message.error(res.msg)
          } else {
            this.$message.error('获取面料要求列表失败！')
          }
        }
      } catch (error) {
        this.$message.error('获取面料要求列表失败！')
      }
    },
    async loadScoriginarea() {
      // this.form.sccf = ''
      const params = {
        sccode: this.sccode,
        size: this.pageSize,
        pageNo: this.pageNum
      }
      try {
        const res = await getSampleGroupList(params)
        if (res.code == 200) {
          const newArr = []
          res.data.records.map((item)=>{
            this.typeList.map((subitem)=>{
              if(item.sccf == subitem.code){
                newArr.push(subitem.extendAttr1)
              }
            })
          })
          if(newArr.includes('Y')){
            this.form.scoriginarea = 'Y'
          }else{
            this.form.scoriginarea = ''
          }
        } 
      } catch (error) {
        this.$message.error('获取环保标签失败！')
      }
    },
    onSubmit() {
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          this.save()
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    async save() {
      this.spinning = true
      try {
        this.form.jobnumber = this.jobNumber
        this.form.sccreator = this.userInfo.realname
        let res = this.form.sccode ? await sampleUpdate(this.form) : await sampleAdd(this.form)
        if (res.code == 200) {
          this.$message.success('保存成功！')
          if (!this.form.sccode) {
            this.form.sccode = res.msg
            this.sccode = res.msg
          }
          this.$nextTick(() => {
            this.loadAcc(this.form.sccode)
          })
        } else {
          if (res.msg) {
            this.$message.error(res.msg)
          } else {
            this.$message.error('保存失败！')
          }

        } this.spinning = false
      } catch (error) {
        this.spinning = false

        this.$message.error('保存失败！')
      }
    },
    async loadAcc(sccode) {
      this.loading = true
      this.schavpict = []
      try {
        const res = await getSampleInfo({ sccode: sccode })
        if (res.code == 200) {
          this.form = res.data
          if(res.data.schavpict){
            this.schavpict.push(res.data.schavpict)
          }
        } else {
          if (res.msg) {
            this.$message.error(res.msg)
          } else {
            this.$message.error('获取列表详情失败！')
          }
          this.disabled = true
        }
        this.loading = false
      } catch (error) {
        this.loading = false
        this.disabled = true
      }
    },
    sync(values) {
      this.supplyList.map(item => {
        if (item.supplyCode == values.supplyCode) {
          item.defaultStatus = 1
          this.accPriceList = item.accPriceList
        } else {
          item.defaultStatus = 0
        }
      })
    },
    closePrice(supplyCode, list) {
      this.showPrice = false
      if (list) {
        this.supplyList.map(item => {
          if (item.supplyCode == supplyCode) {
            item.accPriceList = list
            if (item.defaultStatus == 1) {
              this.accPriceList = list
            }
          }
        })
        this.form.accSupplyList = this.supplyList
      }
    }
  }
}
</script>
<style>
.tableHiddle {
  display: none;
}

.tableShow {
  display: revert;
}
</style>